<style>
    .layui-form .layui-form-item .layui-inline{
        padding-left: 5px;
    }
    .layui-form .layui-form-item .layui-inline input{
        width: 180px;
    }
</style>
<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <input type="text" name="datetime" id="datetime" placeholder="start_time _ end_time" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-inline">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i
                        class="iconfont icon-chaxun"></i>Search</button>
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="user_data_update">Update Data</button>
            </div>
        </div>
    </div>
</form>
<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'laydate', 'table',], function () {
        var laydate = layui.laydate,
            form = layui.form,
            table = layui.table; //表格
        //时间插件
        laydate.render({
            elem: '#datetime',
            range: '_',
            format: 'yyyy-MM-dd'
        });
        var tableIn =table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            url: "{:url('accountApi')}",
            id: 'balanceTable',
            cols: [[
                { type: 'numbers'},
                { field: 'user_919', align: 'center', title: '(919)用户' },
                {field: 'amount_919', title: '(919)用户余额($)', align:"center",
                    style:'color:#FF5722;font-weight:bold'},
                { field: 'user_616', align: 'center', title: '(616)用户' },
                {field: 'amount_616', title: '(616)用户余额($)', align:"center",
                    style:'color:#FF5722;font-weight:bold'},
                {field: 'amount_lss', title: '(Connexpay)用户余额($)', align:"center",
                    style:'color:#FF5722;font-weight:bold'},
                { field: 'user_75J', align: 'center', title: '(M75J)用户' },
                {field: 'amount_75J', title: '(M75J)用户余额($)', align:"center",
                    style:'color:#FF5722;font-weight:bold'},
                { align: 'center', title: '查询时间' , width: 160,
                    templet: function (d) {
                        return layui.util.toDateString(d.ctime * 1000, "yyyy-MM-dd HH:mm:ss");
                    }
                },
            ]],
            page: true,
            limit: 20,
            limits: [20, 50, 100],
        });
        form.on('submit(*)', function (data) {
            layui.table.reload('balanceTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        layui.form.on('submit(user_data_update)', function () {
            var loading =layer.load(1, {shade: [0.1,'#fff']});
            JsPost("{:url('balance/upBankAccount')}",'', function(res){
                layer.close(loading);
                if(res.code >0){
                    layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                        tableIn.reload({
                            page:{
                                curr :1
                            }
                        });
                    });
                }else{
                    layer.msg(res.msg , {time:1500 , icon:2});
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>